package com.cskaoyan.controller;

import com.cskaoyan.bean.PO.WxCatalogIndexpo;
import com.cskaoyan.bean.VO.WxCatalogIndexVo;
import com.cskaoyan.bean.common.BaseRespVo;
import com.cskaoyan.service.WxCatalogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description:类目
 * @author:刘杰
 * @create: 2022-08-17 09:16
 */
@RestController
@RequestMapping("wx/catalog")
public class WxCatalogController {

    @Autowired
    WxCatalogService wxCatalogService;

    /**
     * 显示所有的类目
     * @return
     */
    @RequestMapping("index")
    public BaseRespVo index(){
        WxCatalogIndexVo wxCatalogIndexVo = wxCatalogService.index();
        return BaseRespVo.ok(wxCatalogIndexVo);
    }

    /**
     * 查看点击的类目
     * @param id
     * @return
     */
    @RequestMapping("current")
    public BaseRespVo current(Integer id){
        WxCatalogIndexpo wxCatalogIndexpo = wxCatalogService.current(id);
        return BaseRespVo.ok(0,wxCatalogIndexpo,"成功");
    }

}
